package linkedlist.reverse;

import linkedlist.Node;

/**
 * @Author wangtengyu
 * @Create 2018-09-03-14:49
 */
public class LoopReverse {

  public Node reverseLinkedList(Node node) {

    Node prev = null;
    Node now = node;
    while (now != null) {
      Node next = now.getNext();
      now.setNext(prev);
      prev = now;
      now = next;
    }
    return prev;


  }


}
